package com.ruoyi.active.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.active.mapper.TbActiveRuleMapper;
import com.ruoyi.active.domain.TbActiveRule;
import com.ruoyi.active.service.ITbActiveRuleService;

/**
 * 活动规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-01
 */
@Service
public class TbActiveRuleServiceImpl implements ITbActiveRuleService 
{
    @Autowired
    private TbActiveRuleMapper tbActiveRuleMapper;

    /**
     * 查询活动规则
     * 
     * @param ruleId 活动规则主键
     * @return 活动规则
     */
    @Override
    public TbActiveRule selectTbActiveRuleByRuleId(Long ruleId)
    {
        return tbActiveRuleMapper.selectTbActiveRuleByRuleId(ruleId);
    }

    /**
     * 查询活动规则列表
     * 
     * @param tbActiveRule 活动规则
     * @return 活动规则
     */
    @Override
    public List<TbActiveRule> selectTbActiveRuleList(TbActiveRule tbActiveRule)
    {
        return tbActiveRuleMapper.selectTbActiveRuleList(tbActiveRule);
    }

    /**
     * 新增活动规则
     * 
     * @param tbActiveRule 活动规则
     * @return 结果
     */
    @Override
    public int insertTbActiveRule(TbActiveRule tbActiveRule)
    {
        tbActiveRule.setCreateTime(DateUtils.getNowDate());
        return tbActiveRuleMapper.insertTbActiveRule(tbActiveRule);
    }

    /**
     * 修改活动规则
     * 
     * @param tbActiveRule 活动规则
     * @return 结果
     */
    @Override
    public int updateTbActiveRule(TbActiveRule tbActiveRule)
    {
        tbActiveRule.setUpdateTime(DateUtils.getNowDate());
        return tbActiveRuleMapper.updateTbActiveRule(tbActiveRule);
    }

    /**
     * 批量删除活动规则
     * 
     * @param ruleIds 需要删除的活动规则主键
     * @return 结果
     */
    @Override
    public int deleteTbActiveRuleByRuleIds(Long[] ruleIds)
    {
        return tbActiveRuleMapper.deleteTbActiveRuleByRuleIds(ruleIds);
    }

    /**
     * 删除活动规则信息
     * 
     * @param ruleId 活动规则主键
     * @return 结果
     */
    @Override
    public int deleteTbActiveRuleByRuleId(Long ruleId)
    {
        return tbActiveRuleMapper.deleteTbActiveRuleByRuleId(ruleId);
    }
}
